package common.helper.json;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * Created by julianzliu on 4/21/2017.
 */
public class JavaObjectToJsonNode {


    /*
    http://stackoverflow.com/questions/11828368/convert-java-object-to-jsonnode-in-jackson
     */

    public static JsonNode ObjectToNode(Object object){
        ObjectMapper mapper = new ObjectMapper();
        JsonNode node = mapper.convertValue(object, JsonNode.class);
        return node;
    }
}
